<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>企业</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="Expires" CONTENT="0">
    <meta http-equiv="Cache-Control" content="no-siteapp,no-transform,no-store, no-cache, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/weadmin.css">
    <script type="text/javascript" src="/lib/layui/layui.js" charset="utf-8"></script>
    <link rel="stylesheet" href="/static/css/buildUnit/common.css">
    <style type="text/css">
        .layui-container {
            padding-top: 20px;
            width: 100%;
        }
    </style>
</head>
<body>
<div class="layui-container">
    <form id="form" class="layui-form layui-form-pane" action="" lay-filter="example">
        <input type="hidden" name="buildCorpId" class="formData" value="">
        <input type="hidden" name="prjId" class="formData" value="">
        <!--建设单位信息-->
        <div class="layui-collapse">
            <div class="layui-colla-item">
                <h2 class="layui-colla-title">单位信息</h2>
                <div class="layui-colla-content layui-show">
                    <table class="layui-table v-table">
                        <tbody>
                        <tr class="layui-hide">
                            <td width="24%"></td>
                            <td width="13%"></td>
                            <td width="13%"></td>
                            <td width="24%"></td>
                            <td width="13%"></td>
                            <td width="13%"></td>
                        </tr>
                        <tr>
                            <td class="th8 required">企业名称</td>
                            <td colspan="3">
                                <input type="hidden" name="orgNo" class="formData">
                                <input type="text" name="orgName" lay-verify="isEmpty" placeholder="企业名称"
                                       autocomplete="off" class="layui-input formData layui-disabled" disabled/>
                            </td>
                            <td class="th8 required">统一社会信用代码</td>
                            <td colspan="2">
                                <input type="text" name="creditCode" lay-verify="isEmpty" placeholder="统一信用代码"
                                       autocomplete="off" class="layui-input formData layui-disabled" disabled/>
                            </td>
                        </tr>
                        <tr>
                            <td class="th8 required">企业注册属地</td>
                            <td colspan="5">
                                <div class="layui-input-inline">
                                    <select name="provinceNo"  lay-filter="provinceNo" lay-verify="isEmpty"
                                            class="formData">
                                        <option value="">请选择省</option>
                                    </select>
                                </div>
                                <div class="layui-input-inline">
                                    <select name="cityNo" lay-filter="cityNo" lay-verify="isEmpty" class="formData">
                                        <option value="">请选择市</option>
                                    </select>
                                </div>
                                <div class="layui-input-inline">
                                    <select name="countyNo" lay-filter="countyNo" lay-verify="isEmpty"
                                            class="formData">
                                        <option value="">请选择县/区</option>
                                    </select>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="th8 required">工商注册地址</td>
                            <td colspan="3">
                                <input name="address" lay-verify="isEmpty" type="text"
                                       class="layui-input formData" autocomplete="off"
                                       placeholder="工商注册地址">
                            </td>
                            <td class="th8 required">登录名</td>
                            <td colspan="2">
                                <input type="text" name="userName" lay-verify="isEmpty" placeholder="登录名"
                                       autocomplete="off" class="layui-input formData layui-disabled" disabled/>

                            </td>
                        </tr>
                        <tr>
                            <td class="th8 required">经济性质</td>
                            <td colspan="3">
                                <select lay-verify="required" name="ectType" id="ectType" class="layui-input formData">
                                    <option value="">请选择</option>
                                </select>
                            </td>
                            <td class="th8 required">工商登记类型</td>
                            <td colspan="2">
                                <select name="orgRegistryType" id="orgRegistryType" lay-verify="isEmpty" class="layui-input formData">
                                    <option value="">请选择</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td class="th8 required">基本户开户行</td>
                            <td colspan="3">
                                <input name="basicAccountBank" lay-verify="isEmpty" type="text"
                                       class="layui-input formData" autocomplete="off"
                                       placeholder="基本户开户行">
                            </td>
                            <td class="th8 required">基本户开户行账号</td>
                            <td colspan="2">
                                <input name="basicAccountBankNo" lay-verify="isEmpty" type="text"
                                       class="layui-input formData" autocomplete="off"
                                       placeholder="基本户开户行账号">
                            </td>
                        </tr>
                        <tr>
                            <td class="th8 required">最后年检日期</td>
                            <td colspan="3">
                                <input type="text" name="lastAnnualDate" id="lastAnnualDate" lay-verify="date|isEmpty"
                                       placeholder="" autocomplete="off" class="layui-input formData time"/>
                            </td>
                            <td class="th8 required">工商注册日期</td>
                            <td colspan="2">
                                <input type="text" name="registerDate" id="registerDate" lay-verify="date"
                                       placeholder="" autocomplete="off" class="layui-input formData time"/>
                            </td>
                        </tr>
                        <tr>
                            <td class="th8 required">营业执照登记机关</td>
                            <td colspan="3">
                                <input name="licenseRegisterAuthor" lay-verify="isEmpty" type="text"
                                       class="layui-input formData" autocomplete="off"
                                       placeholder="项目负责人">
                            </td>
                            <td class="th8 required">注册资本金(人民币)</td>
                            <td colspan="2">
                                <input type="text" name="registerCapital" placeholder="" lay-verify="isEmpty"
                                       autocomplete="off"
                                       class="layui-input formData"/>
                            </td>
                        </tr>
                        <tr>
                            <td class="th8 required">企业经营地址</td>
                            <td colspan="6">
                                <input name="businessAddress" lay-verify="isEmpty" type="text"
                                       class="layui-input formData" autocomplete="off"
                                       placeholder="企业经营地址">
                            </td>
                        </tr>
                        <tr>
                            <td class="th8 required">企业营业期限</td>
                            <td colspan="3">
                                <input name="businessDate" lay-verify="isEmpty" type="text"
                                       class="layui-input formData" autocomplete="off"
                                       placeholder="企业营业期限">
                            </td>
                            <td class="th8 required">经营地址邮编</td>
                            <td colspan="2">
                                <input type="text" name="businessFax" lay-verify="isEmpty" placeholder="经营地址邮编"
                                       autocomplete="off"
                                       class="layui-input formData"/>
                            </td>
                        </tr>
                        <tr>
                            <td class="th8 required">经营范围</td>
                            <td colspan="6">
                                <textarea name="businessScope" placeholder="经营范围" lay-verify="isEmpty"
                                          class="layui-textarea formData"></textarea>
                            </td>
                        </tr>
                        <tr>
                            <td class="th8 required">审查机构</td>
                            <td colspan="3">
                                <input type="text" name="checkOrgName" placeholder="审查机构" autocomplete="off"
                                       class="layui-input formData layui-disabled" disabled/>
                            </td>
                            <td class="th8 required">审查时间</td>
                            <td colspan="2">
                                <input type="text" name="checkTime" id="checkTime" lay-verify="date" placeholder="审查时间"
                                       autocomplete="off" class="layui-input formData layui-disabled" disabled/>
                            </td>
                        </tr>
                        <tr>
                            <td class="th8 required">企业法定代表人</td>
                            <td colspan="3">
                                <input name="buildProjectLeaderId" lay-verify="isEmpty" type="text"
                                       class="layui-input formData" autocomplete="off"
                                       placeholder="企业法定代表人">
                            </td>
                            <td class="th8 required">身份证号码</td>
                            <td colspan="2">
                                <input name="userCard" lay-verify="isEmpty" type="text"
                                       class="layui-input formData" autocomplete="off"
                                       placeholder="身份证号码">
                            </td>

                        </tr>
                        <tr>
                            <td class="th8 required">企业联系电话</td>
                            <td colspan="3">
                                <input type="text" name="orgLinkPhone" lay-verify="isEmpty" placeholder="企业联系电话"
                                       autocomplete="off" class="layui-input formData"/>
                            </td>
                        </tr>
                        <tr>
                            <td class="th8 required">联系人</td>
                            <td colspan="3">
                                <input type="text" name="comconnperson" lay-verify="isEmpty" placeholder="企业联系人"
                                       autocomplete="off"
                                       class="layui-input formData"/>
                            </td>
                            <td class="th8 required">身份证号码</td>
                            <td colspan="2">
                                <input name="buildProjectLeaderId" lay-verify="isEmpty" type="text"
                                       class="layui-input formData" autocomplete="off"
                                       placeholder="项目负责人">
                            </td>

                        </tr>
                        <tr>
                            <td class="th8 required">联系电话</td>
                            <td colspan="3">
                                <input type="text" name="orgLinkPhone" lay-verify="isEmpty" placeholder="企业联系电话"
                                       autocomplete="off" class="layui-input formData"/>
                            </td>
                        </tr>
                        <tr>
                            <td class="th8 required">企业简介</td>
                            <td colspan="6">
                                <textarea placeholder="企业简介" name="orgIntroduction" lay-verify="isEmpty"
                                          class="layui-textarea formData"></textarea>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>

        </div>
        <!--企业联系信息-->
        <div class="layui-collapse">
            <div class="layui-colla-item">
                <h2 class="layui-colla-title">单位联系信息</h2>
                <div class="layui-colla-content layui-show">
                    <table class="layui-table v-table">
                        <tbody>
                        <tr class="layui-hide">
                            <td width="24%"></td>
                            <td width="13%"></td>
                            <td width="13%"></td>
                            <td width="24%"></td>
                            <td width="13%"></td>
                            <td width="13%"></td>
                        </tr>
                        <tr>
                            <td class="th8 required">企业联系电话</td>
                            <td colspan="2">
                                <input type="text" name="orgLinkPhone" lay-verify="isEmpty" placeholder="企业联系电话"
                                       autocomplete="off" class="layui-input formData"/>
                            </td>
                            <td class="th8 required">企业联系传真</td>
                            <td colspan="2">
                                <input type="text" name="orgLinkFax" lay-verify="isEmpty" placeholder="企业联系传真"
                                       autocomplete="off" class="layui-input formData"/>
                            </td>
                        </tr>
                        <tr>
                            <td class="th8 required">企业网址</td>
                            <td colspan="2">
                                <input type="text" name="orgWebsite" placeholder="企业网址" autocomplete="off"
                                       lay-verify="isEmpty"
                                       class="layui-input formData"/>
                            </td>
                            <td class="th8 required">企业联系邮箱（密保邮箱)</td>
                            <td colspan="2">
                                <input type="text" name="orgLinkMailbox" placeholder="企业联系邮箱（密保邮箱)" autocomplete="off"
                                       lay-verify="isEmpty"
                                       class="layui-input formData"/>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>

        </div>
        <!--附件信息-->
        <div class="layui-collapse">
            <div class="layui-colla-item">
                <h2 class="layui-colla-title">附件信息</h2>
                <div class="layui-colla-content layui-show">
                    <p>注：照片完整、文字清晰可辨，照片格式为"jpg格式"或"png格式"，扫描分辨率100DPI即可，单张图片不要超过2M。</p>
                    <form id="uploadForm" action="" method="post" enctype="multipart/form-data" style="">
                        <div id="changeUploadModal" class="uploadModal">
                            <div class="modalContent">
                                <table class="layui-table v-table">
                                    <colgroup>
                                        <col width="80px">
                                        <col width="600px">
                                        <col width="180px">
                                        <col>
                                    </colgroup>
                                    <thead>
                                    <th>序号</th>
                                    <th>附件名称</th>
                                    <th>操作</th>
                                    </thead>
                                    <tbody id="attaList">
                                    <tr>
                                        <td>1</td>
                                        <td>文件名字</td>
                                        <td>
                                            <button type="button" class="layui-btn" id="upload">
                                                <i class="layui-icon">&#xe67c;</i>选择文件</button>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </form>
                </div>
            </div>

        </div>
        <div class="layui-form-item" style="margin:25px 40% 15px; ">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="/lib/layui/layui.js"></script>
<script src="/static/js/main.js"></script>
<script>
    layui.use(['form', 'jquery', 'upload', 'matchDict', 'selectFun','configure', 'configureCom', 'on'], function () {
        window.$ = layui.$;
        var form = layui.form;
        var configure = layui.configure;
        var laydate = layui.laydate;
        var upload = layui.upload;
        var selectFun = layui.selectFun;
        var configureCom = layui.configureCom;
        var defaults ={};
        //执行一个laydate实例
        $('.time').each(function (index, item) {
            laydate.render({
                elem: item//, //指定元素
                //   format: 'yyyy-MM-dd'
            });
        });
        //监听submit提交
        form.on('submit(submit)', function (data) {
            var d = getData();
            configureCom.postDataAjax(configure.ORG_UPDATE_HTTP, d).then(function (res) {
                if (res.code == 0) {
                    top.layer.msg('保存成功！');
                } else {
                    top.layer.alert('保存失败,请重试！');
                }
            });
            return false;
        });
        configureCom.postDataAjax(configure.MY_COMPANY_LIST_HTTP, {}).then(function (res) {
            console.log(res.sysOrgEntity);
            var typeData = res.sysOrgEntity;
            configureCom.selectDataFun(configure.ORG_REGIST_TYPE, typeData.orgRegistryType, '#orgRegistryType');//工商登记类型
            configureCom.selectDataFun(configure.ECT_TYPE, typeData.ectType, '#ectType');//经济类型
            defaults = {
                s1: 'provinceNo',
                s2: 'cityNo',
                s3: 'countyNo',
                v1: 450000,
                v2: typeData.cityNo,
                v3: typeData.countyNo
            };
            selectFun.treeSelect(defaults);
            form.render();
            form.val('example', typeData);

        });
        var token = configureCom.getToken();
        var updateDTO = {
            file:'file',
            businessId: 1,
            code:'aptitude'
        };
        //执行上传
        var uploadInst = upload.render({
            elem: '#upload' //绑定元素
            ,url: configure.SYS_FILE_UPLOAD //上传接口
            ,headers:{
                token: token
            }
            ,data:updateDTO
            ,before: function(obj){
                layer.load();
            }
            ,done: function(res){//上传完毕回调
                layer.closeAll('loading');
                layer.msg('上传成功!');
            }
            ,error: function(){//请求异常回调
                layer.closeAll('loading');
                layer.msg('网络异常，请稍后重试！');
            }
        });
        /*$('.upload').on('click', function (res) {


        });*/

        /*configureCom.postDataAjax(configure.PROJECT_FILE_LIST_HTTP,{}).then(function (res) {
                    $.each(res.result, function (i, v) {
                        var html = '';
                        var className = 'filePicker' + i;
                        html += '<tr>' +
                            '      <td>' + (i + 1) + '</td>' +
                            '      <td class="fjName">' + v.name + '</td><td class="fjContent">';
                        html += returnHtml(className, type, v);
                        html += '  </td></tr>';
                        $('#attaList').append(html);
                        uploadCommon.uploadreInt(className, i, v);
                    });
                });*/
        function returnHtml(className, type, v) {
            var attaId = '';
            var objectId = '';
            var fileName = '';
            var showName = '';

            var html = '';
            if (v.attachmentFileDTOList) {
                var atta = v.attachmentFileDTOList;
                if (atta.length == 0) {
                    html = '<div class="' + className + '" data-name="" data-num="' + v.countMax + '" data-tmpId="' + v.tsAttachmentTmplId + '">请上传</div>';
                } else if (atta.length > 0) {
                    if (v.countMax > 1) {
                        html += '<div class="' + className + '" data-name="" data-num="' + v.countMax + '" data-tmpId="' + v.tsAttachmentTmplId + '">继续上传</div>';
                    } else {
                        html += '<div class="' + className + ' webuploader-element-invisible" data-name="" data-num="' + v.countMax + '" data-tmpId="' + v.tsAttachmentTmplId + '">请上传</div>';
                    }
                    $.each(atta, function (s, k) {
                        var attaId = atta[s].trDataAttachmentId || '';
                        html += '<div class="file-item">' +
                            '<div class="info">' +
                            '<span class="fileNameTxt" data-tmpId="' + v.tsAttachmentTmplId + '"  data-id="' + atta[s].objectId + '" data-attaId="' + attaId + '" data-url="' + atta[s].fileName + '">' + atta[s].showName + '</span>' +
                            '<span data-saveid="' + atta[s].objectId + '" data-name="' + atta[s].fileName + '" data-tmpId="' + v.tsAttachmentTmplId + '"  onclick=showDeleteFile(this) class="fileDelete">x</span>' +
                            '</div>' +
                            '</div>';
                    });
                }
            } else {
                html = '<div class="' + className + '" data-name="" data-num="' + v.countMax + '" data-tmpId="' + v.tsAttachmentTmplId + '">请上传</div>';
            }

            return html;
        }
    });

    function getData() {
        var data = {};
        $('.formData').each(function (index, item) {
            var key = $(item).attr('name');
            data[key] = $(item).val();
        });
        return data;
    }
</script>
</body>
</html>
